var a = getApp(), t = "";

Page({
    data: {
        data_textarea: a.globalData.linkwenan,
        data_color: [ {
            color: "#000000",
            value: "(默认磨砂黑色)"
        }, {
            color: "#ef8201",
            value: "(当前橘黄色)"
        }, {
            color: "#485158",
            value: "(当前阔绿色)"
        }, {
            color: "#007abb",
            value: "(当前天蓝色)"
        }, {
            color: "#bb0512",
            value: "(当前绯红色)"
        }, {
            color: "#729998",
            value: "(当前深豆绿色)"
        }, {
            color: "#86736c",
            value: "(当前咖啡色)"
        }, {
            color: "#f9dc76",
            value: "(当前米黄色)"
        }, {
            color: "#ffffff",
            value: "(当前亮丽白)"
        } ],
        wenannr: "文案内容:0/100",
        moshi: "(当前信封模式)",
        data_beijing: a.globalData.linkbeijing,
        data_peitu: a.globalData.linkpeitu,
        data_geming: a.globalData.linkgeming,
        visi: "visible",
        daxiao: 35,
        sudu: 150,
        szmm_hidden: "none",
        juzhong: "center",
        neirong: "",
        morenmima: "(默认 - 1314)",
        bj_mengban: "none",
        data_color2: "#000000",
        data_value2: "(默认磨砂黑色)",
        data_transform1: "scale(1.0)",
        data_transform2: "scale(1.0)",
        data_transform3: "scale(1.0)",
        data_transform4: "scale(1.0)",
        poin: "none",
        opac: 0,
        pdba: 0
    },
    view_b2_bjtap: function(a) {
        wx.navigateTo({
            url: "/pages2/kpbj/kpbj"
        });
    },
    view_b2_pttap: function(a) {
        wx.navigateTo({
            url: "/pages2/wapt/wapt"
        });
    },
    view_b2_b2_xftap: function(t) {
        var n = this;
        wx.showActionSheet({
            itemList: [ "信封模式", "密码模式" ],
            success: function(t) {
                0 == t.tapIndex ? n.setData({
                    moshi: "(当前信封模式)",
                    szmm_hidden: "none"
                }) : n.setData({
                    moshi: "(当前密码模式)",
                    szmm_hidden: "block"
                }), a.globalData.linkmoshi = n.data.moshi;
            },
            fail: function(a) {
                console.log(a.errMsg);
            }
        });
    },
    view_a2_view_tap: function() {
        wx.navigateTo({
            url: "/pages2/wenan2/index"
        });
    },
    view_b2_b2_tap: function() {
        wx.navigateTo({
            url: "/pages2/yinyue/yinyue"
        });
    },
    view_b2_b2_mmtap: function(t) {
        a.show(this, "slide_up1", 1), this.setData({
            pdba: 1,
            poin: "auto"
        });
    },
    bindTextAreaBlur: function(a) {
        t = a.detail.value;
    },
    view_a2_input_put: function(t) {
        this.setData({
            wenannr: "文案内容:" + t.detail.value.length + "/100"
        }), a.globalData.linkwenan = t.detail.value;
    },
    view_c2_c1_tap: function(t) {
        this.setData({
            data_color2: t.currentTarget.dataset.color,
            data_value2: t.currentTarget.dataset.value
        }), a.globalData.linkfontcolor = this.data.data_color2, a.globalData.linkcolorvalue = this.data.data_value2;
    },
    quxiao: function(t) {
        a.show(this, "slide_up1", 0), this.setData({
            pdba: 1,
            poin: "none"
        });
    },
    queding: function(n) {
        var l = this;
        setTimeout(function() {
            t.length >= 4 ? (a.globalData.linkpassword = t, a.show(l, "slide_up1", 0), l.setData({
                morenmima: "(新密码 - " + t + ")",
                neirong: "",
                pdba: 1,
                poin: "none"
            })) : wx.showModal({
                title: "提示",
                content: "请输入四位数字密码",
                cancelText: "取消",
                confirmText: "重新输入"
            });
        }, 100);
    },
    daxaiojian1: function(t) {
        var n = this, l = this.data.daxiao;
        this.data.daxiao > 1 ? (this.setData({
            daxiao: parseInt(l) - 1,
            data_transform1: "scale(1.2)"
        }), a.globalData.linkfontsize = this.data.daxiao) : wx.showToast({
            title: "不能低于1"
        }), setTimeout(function() {
            n.setData({
                data_transform1: "scale(1.0)"
            });
        }, 200);
    },
    daxaiojia1: function(t) {
        var n = this, l = this.data.daxiao;
        this.setData({
            daxiao: parseInt(l) + 1,
            data_transform2: "scale(1.2)"
        }), a.globalData.linkfontsize = this.data.daxiao, setTimeout(function() {
            n.setData({
                data_transform2: "scale(1.0)"
            });
        }, 200);
    },
    sudujian2: function(t) {
        var n = this, l = this.data.sudu;
        this.data.sudu > 0 ? (this.setData({
            sudu: parseInt(l) - 10,
            data_transform3: "scale(1.2)"
        }), a.globalData.linkfontspeed = this.data.sudu) : wx.showToast({
            title: "不能低于0"
        }), setTimeout(function() {
            n.setData({
                data_transform3: "scale(1.0)"
            });
        }, 200);
    },
    sudujia2: function(t) {
        var n = this, l = this.data.sudu;
        this.setData({
            sudu: parseInt(l) + 10,
            data_transform4: "scale(1.2)"
        }), a.globalData.linkfontspeed = this.data.sudu, setTimeout(function() {
            n.setData({
                data_transform4: "scale(1.0)"
            });
        }, 200);
    },
    view2_A_yltap: function(a) {
        "(当前信封模式)" == this.data.moshi ? wx.navigateTo({
            url: "/pages2/yulan/index"
        }) : wx.navigateTo({
            url: "/pages2/yulan2/index"
        });
    },
    view2_A_sctap: function(a) {
        wx.showToast({
            title: "生成中...",
            mask: !0,
            icon: "loading",
            duration: 3e3
        }), this.sctupian();
    },
    chongzhi_tap: function(t) {
        var n = this;
        wx.showModal({
            content: "确认重置所有内容吗",
            confirmText: "确认",
            success: function(t) {
                t.confirm && (a.globalData.linkmoshi = "(当前信封模式)", a.globalData.linkwenan = "尽管没有深情的告白，也没有诚挚的诺言，但在顺其自然中我们就成为了彼此的唯余生漫漫，我愿与你风雨中执手，平淡中偕老。", 
                a.globalData.linkbeijing = "https://s.88y.cn/group1/M00/04/01/CqchNGBp6aWASv0LAAEDbeCFkfQ521.jpg", 
                a.globalData.linkpeitu = "https://inews.gtimg.com/newsapp_ls/0/13375976707/0", a.globalData.linkmusicurl = "https://224diy.com/api/163/1804320463.mp3", 
                a.globalData.linkgeming = "(踏山河 - 是七叔呢)", a.globalData.linkpassword = "1314", a.globalData.linkfontcolor = "#000", 
                a.globalData.linkfontsize = "35", a.globalData.linkfontspeed = "150", a.globalData.linkcolorvalue = "(默认磨砂黑色)", 
                n.setData({
                    data_textarea: a.globalData.linkwenan,
                    wenannr: "文案内容:" + a.globalData.linkwenan.length + "/100",
                    data_geming: a.globalData.linkgeming,
                    data_beijing: a.globalData.linkbeijing,
                    data_peitu: a.globalData.linkpeitu,
                    data_color2: a.globalData.linkfontcolor,
                    data_value2: a.globalData.linkcolorvalue,
                    daxiao: a.globalData.linkfontsize,
                    sudu: a.globalData.linkfontspeed,
                    morenmima: "(默认 - " + a.globalData.linkpassword + ")",
                    moshi: "(当前信封模式)",
                    szmm_hidden: "none"
                }));
            }
        });
    },
    onShow: function() {
        this.setData({
            data_textarea: a.globalData.linkwenan,
            wenannr: "文案内容:" + a.globalData.linkwenan.length + "/100",
            data_geming: a.globalData.linkgeming,
            data_beijing: a.globalData.linkbeijing,
            data_peitu: a.globalData.linkpeitu,
            data_color2: a.globalData.linkfontcolor,
            data_value2: a.globalData.linkcolorvalue,
            daxiao: a.globalData.linkfontsize,
            sudu: a.globalData.linkfontspeed
        }), "1314" == a.globalData.linkpassword ? this.setData({
            morenmima: "(默认 - " + a.globalData.linkpassword + ")"
        }) : this.setData({
            morenmima: "(新密码 - " + a.globalData.linkpassword + ")"
        }), "(当前信封模式)" != a.globalData.linkmoshi && this.setData({
            moshi: "(当前密码模式)",
            szmm_hidden: "block"
        });
    },
    onShareAppMessage: function() {},
    sctupian: function() {
        var t = this;
        "(当前信封模式)" == a.globalData.linkmoshi ? wx.request({
            url: "https://224diy.com/result/xf.php",
            method: "POST",
            data: {
                wenan: a.globalData.linkwenan,
                wabeijing: a.globalData.linkbeijing,
                wapeitu: a.globalData.linkpeitu,
                yinyue: a.globalData.linkmusicurl,
                fontcolor: a.globalData.linkfontcolor,
                fontsize: parseInt(a.globalData.linkfontsize) + 5 + "px",
                fontsudu: a.globalData.linkfontspeed
            },
            header: {
                "Content-Type": "application/x-www-form-urlencoded"
            },
            success: function(t) {
                a.globalData.linkplaceholder = t.data, "" == a.globalData.linkplaceholder ? wx.showToast({
                    title: "加载链接失败,请重新生成"
                }) : (wx.hideToast(), wx.navigateTo({
                    url: "/pages2/shengcheng/index"
                }));
            }
        }) : wx.request({
            url: "https://224diy.com/result/mm.php",
            method: "POST",
            data: {
                pwd: a.globalData.linkpassword,
                wenan: a.globalData.linkwenan,
                wabeijing: a.globalData.linkbeijing,
                wapeitu: a.globalData.linkpeitu,
                yinyue: a.globalData.linkmusicurl,
                fontcolor: a.globalData.linkfontcolor,
                fontsize: parseInt(a.globalData.linkfontsize) + 5 + "px",
                fontsudu: a.globalData.linkfontspeed
            },
            header: {
                "Content-Type": "application/x-www-form-urlencoded"
            },
            success: function(n) {
                a.globalData.linkplaceholder = n.data, "" == t.data.placeholder ? wx.showToast({
                    title: "加载链接失败,请重新生成"
                }) : (wx.hideToast(), wx.navigateTo({
                    url: "/pages2/shengcheng/index"
                }));
            }
        });
    }
});